package Thread;
/**
 * 多个窗口完成多个任务：
 * 三个窗口各卖10张票
 */
class MyThread1 extends Thread{

    private int ticket = 10;
    private String name;
    public MyThread1(String name){
        this.name =name;
    }

    public void run(){
        for(int i =0;i<500;i++){
            if(this.ticket>0){
                System.out.println(this.name+"卖票---->"+(this.ticket--));
            }
        }
    }
}
public class demo1Thread {

    public static void main(String[] args) {
        MyThread1 mt1= new MyThread1("一号窗口");
        MyThread1 mt2= new MyThread1("二号窗口");
        MyThread1 mt3= new MyThread1("三号窗口");
        mt1.start();
        mt2.start();
        mt3.start();
    }

}
